<?php
class BrandAction extends BaseAction{
	// 品牌模块首页
	public function index(){
		$pageData = service('Brand')->search4UserBrand($map,10);
		$showBrands = service('Brand')->selectShowBrand();
		
		$this->assign('showBrands', $showBrands);
		$this->assign('pageData', $pageData);
		$this->display();
	}
	
	/** 一般用于ajax查询品牌 **/
	public function ajxSearch(){
		$bscode				= $_REQUEST['bscode'];		//品牌类型
		//$pno				= $_REQUEST['pno'];			//页数
		$map['bscode']=$bscode;
		$pageData = service('Brand')->search4UserBrand($map,4);
		
		$this->assign('pageData', $pageData);
		$this->display('brand_list_box');	
	}
	
	
	public function detail(){
		$bid = $_REQUEST['bid'];
		$subitem = $_REQUEST['subitem'];
		if(empty($subitem))$subitem = 'goods';
		if(empty($bid))$this->error('品牌不存在！');
		$brand = service('Brand')->getById($bid);
		if(empty($brand))$this->error('品牌不存在！');
		if($subitem=='story'){
			$brandExtInfo = service('Brand')->getExtInfoByBid($bid);
			$this->assign('brandExtInfo', $brandExtInfo);
		}
		$this->assign('brand', $brand);
		$this->assign('subitem', $subitem);
		$this->display();
	}
	
	
	public function ajxSearchGoods(){
		$brandid			= $_REQUEST['brandid'];	//商户id		对应页面右侧主搜索区
		$stype				= $_REQUEST['stype'];		//排序类型	对应页面右侧主搜索区 'sale' 'new' 'up'  'down'
		$pno				= $_REQUEST['pno'];			//页数
		if(empty($stype))$stype	= 'sale';
		if(empty($pno))$pno	= 1;
		
		$this->assign('stype', $stype);
		$this->assign('brandid', $brandid);
		$this->display('goods_list_box');
	}
	
	public function ajxShowPlace(){
		$this->display('place_list_box');
	}
	
	
	public function ajxSearchBSub(){
		$this->display('bsub_list_box');
		
	}
	
	public function ajxShowStory(){
		$brandid			= $_REQUEST['brandid'];	//商户id		对应页面右侧主搜索区
		$brandExtInfo = service('Brand')->getExtInfoByBid($brandid);
		$this->assign('brandExtInfo', $brandExtInfo);
		$this->display('story_list_box');
	}
}
?>